package user;

import InputCheck.InputCheck;
import Ioperations.*;
import book.Bookshelf;

import java.util.Scanner;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 28318
 * Date: 2025-10-25
 * Time: 17:02
 */
public class NormalUser extends User{

    public void doIoperation(int choice, Bookshelf book){
        if (choice >= 0 && choice <= 3){
            this.ioperWork[choice].work(book);
        }else {
            System.out.println("指令输入错误...");
        }
    }

    public NormalUser(String name, int userID) {
        super(name, userID);
        this.ioperWork[0] = new ExitIoperation();
        this.ioperWork[1] = new FindIoperation();
        this.ioperWork[2] = new BorrowIoperation();
        this.ioperWork[3] = new ReturnIoperation();
    }


    @Override
    public int menu() {
        System.out.println("欢迎您* "+this.getName()+" *用户");
        System.out.println("*****图书管理系统普通用户*****");
        System.out.println("输入1来查找图书");
        System.out.println("输入2来借阅图书");
        System.out.println("输入3来归还图书");
        System.out.println("输入0来退出系统");
        System.out.println("**************************");
        System.out.print("请输入->");
        int inPut = InputCheck.ExceptionCheck();
        return inPut;
    }
}
